<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>雷达</title>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta name="viewport"
          content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="app-mobile-web-app-capable" content="yes"/>
    <meta name="app-mobile-web-app-status-bar-style" content="black-translucent"/>
    <link rel="stylesheet" href="//at.alicdn.com/t/font_772560_nyw5t78j0pd.css">
    <link rel="stylesheet" href="css/label.css">
</head>
<body>
<div id="app">
    <div class="wrap">
        <p class="title">标签名称</p>
        <div>
            <p class="label" v-if="name">{{name}}</p>
            <div class="label-input" v-else><input type="text" placeholder="请输入标签" v-model="tagName"></div>
        </div>
        <p class="title">标签成员</p>
        <a :href="tagName||name?'./add-member.html?type='+type+'&id='+tagId+'&name='+tagName:''" class="add-label flex align">
            <i class="ra ra-add"></i>
            <i>添加成员</i>
        </a>
        <ul>
            <li class="" v-for="item in customer">
                <a :href="'./time-detail.html?name='+item.name+'&cus_im_id='+item.cus_im_id+'&face_url='+item.face_url" class="member flex align">
                    <img :src="item.face_url" alt="">
                    <p class="name">{{item.name}}</p>
                </a>
            </li>
        </ul>
    </div>
</div>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.min.js"></script>
<script type="text/javascript">

    var app=new Vue({
        el:'#app',
        data:{
            name:'',
            tagId:'',
            type:'',
            customer:[],
            tagName:''
        },
        created: function () {
            this.loadData()
        },
        methods:{
            GetQueryString:function (id) {
                {
                    var reg = new RegExp("(^|&)"+ id +"=([^&]*)(&|$)");
                    var r = decodeURI(window.location.search.substr(1)).match(reg);
                    if(r!=null)return  unescape(r[2]); return null;
                }
            },
            loadData:function () {
                var id = sessionStorage.getItem('login_identifier')
                this.tagId=this.GetQueryString('id')
                this.name=this.GetQueryString('name')
                if(this.tagId){
                    this.type=1
                }else{
                    this.type=2
                }
                axios({
                    url:'https://qyim.ec51.com/v1/check/get-customer-by-tag',
                    method:'get',
                    params :{
                        id:id,
                        tagID:this.tagId
                    }
                }).then(res=>{
                    this.customer=res.data.data
                })
            },

        }

    })
</script>
</body>
</html>